from app import db


class UploadFile(db.Model):
    __tablename__ = 'upload_file'

    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    filecontext = db.Column(db.LargeBinary(), nullable=True)
    filepath = db.Column(db.String(150), nullable=False)

    def __init__(self, filecontext, filepath):
        self.filecontext = filecontext
        self.filepath = filepath


class FileKey(db.Model):
    __tablename__ = 'file_key'

    id = db.Column(db.Integer(), primary_key=True, autoincrement=True)
    ufid = db.Column(db.Integer(), nullable=False)
    filename = db.Column(db.String(50), nullable=False)
    key1 = db.Column(db.String(50), nullable=True)
    key2 = db.Column(db.String(50), nullable=True)
    key3 = db.Column(db.String(50), nullable=True)

    def __init__(self, ufid, filename, key1, key2, key3):
        self.ufid = ufid
        self.filename = filename
        self.key1 = key1
        self.key2 = key2
        self.key3 = key3
